From 8e6f4fc803708afdcdb4f81a15f59b9cbb9274a4 Mon Sep 17 00:00:00 2001 From: Cody Russell Date: Wed, 3 Nov 1999 00:37:40 +0000 Subject: [PATCH] src/gdk-pixbuf-drawable.c: Changed the behavior to return NULL if part of the requested image is offscreen, rather than clipping the image. --- gdk-pixbuf/ChangeLog | 5 +++++ gdk/gdkpixbuf-drawable.c | 20 ++++++-------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index 3091185cae..1a9aef5ecc 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,8 @@ +1999-11-02 Cody Russell + * src/gdk-pixbuf-drawable.c: Changed the behavior to return NULL + if part of the requested image is offscreen, rather than clipping + the image. + 1999-11-02 Jonathan Blandford * src/io-gif.c (gif_fill_in_lines): Fill in the gif's blank areas diff --git a/gdk/gdkpixbuf-drawable.c b/gdk/gdkpixbuf-drawable.c index dbbd6f18b1..d0c3151f10 100644 --- a/gdk/gdkpixbuf-drawable.c +++ b/gdk/gdkpixbuf-drawable.c @@ -39,20 +39,12 @@ gdk_pixbuf_from_drawable_core (GdkWindow *window, gint x, gint y, gint width, gi &window_width, &window_height, NULL); gdk_window_get_origin(window, &window_x, &window_y); - if(window_x < 0) { - x = ABS(window_x); - width = window_width - x; - } else { - width = CLAMP(window_x + window_width, window_x, - screen_width) - window_x; - } - - if(window_y < 0) { - y = ABS(window_y); - height = window_height - y; - } else { - height = CLAMP(window_y + window_height, window_y, - screen_height) - window_y; + /* If part of the requested image is offscreen, return NULL. */ + if((window_x) < 0 || (window_y < 0) || + (window_x + window_width > screen_width) || + (window_y + window_height > screen_height)) + { + return NULL; } image = gdk_image_get (window, x, y, width, height); -- 2.30.2